package picoevo.es.cmaes.cma;

/**
 * Interface to a single-objective function to be minimized, that accepts an
 * array of points double[][] to be evaluated within one call to method f().
 * Expample code for an axis-parallel ellipsoid function:
 * 
 * <pre>
 * class ElliParallel implements IObjectiveFunctionParallel {
 * 	ElliParallel(double axisratio) {
 * 		this.axisratio = axisratio;
 * 	}
 * 
 * 	public double[] f(double[][] arx) {
 * 		double[] res = new double[arx.length];
 * 		for (int i = 0; i &lt; arx.length; ++i)
 * 			res[i] = fsingle(arx[i]);
 * 		return res;
 * 	}
 * 
 * 	double axisratio = 1e3;
 * 
 * 	double fsingle (double[] x) {
 *  double res = 0.;
 *  for (int i = 0; i &lt; x.length; ++i)
 *  res += Math.pow(axisratio*axisratio,(i-1.)/(x.length-1.)) 
 * x[i] * x[i]; 
 *  return res;
 *  }
 * }
 * </pre>
 */
public interface IObjectiveFunctionParallel {

	/**
	 * @param arx
	 *            is an array of search points to be evaluated, where arx[i] is
	 *            the i-th point.
	 * @return array of objective function values. The i-th value is the
	 *         objective function value of arx[i].
	 */
	double[] valueOf(double arx[][]);
}
